<template>
  <view class="contain">

    <view>
      <u-toast ref="uToast" />
    </view>
    <view class="top-content"></view>

    <view class="top" >
      
    </view>
   <!-- <u-tabs-swiper class="tabs" ref="tabs" :current='swiperCurrent' active-color="#2979ff" :list="list" :is-scroll="false" @change="tabsChange"></u-tabs-swiper> -->
 
<view style="padding:20rpx">
	<u-grid :col="4" :border=false>
		<u-grid-item :class="'grid'+Number(index%5+1)" v-for="(item, index) in groupNemberList" :key="index" @click="btn(item)">
      <text  style="font-size:32rpx;font-weight:bold;}">{{item.g_name}}</text>
			<view class="grid-text" style="font-size:20rpx">{{item.num}}台</view>
		</u-grid-item>
	</u-grid>
</view>
         <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
  </view>
</template>
<script>
import card from "./card";
import card1 from "./carddan";
export default {
  components: {
    card,
    card1
  },
  data() {
    return {
      sip_id:'',
      back: false,
      groupNemberList: [],
      groupNemberList1: [],
      taskId: "1",
      timeone: 0,
      status: "nomore",
      iconType: "flower",
      iconType: "flower",
      loadText: {
        loadmore: "暂无数据",
        loading: "努力加载中",
        nomore: "没有更多数据"
      }
    };
  },
  onLoad(val) {
    this.admin_id = val.admin_id;
    this.host = val.host;
    this.sip_id=val.sip_host
  },
  onShow() {
  // URL='api/'
    URL='https://iotplat.yunzhen.tech:8083/runde_api/'

    // console.log('grouponShow')
     uni.showLoading({
        title: '加载中'
      })
    let _this = this;
    uni.request({
      //  url: "hhttps://iotplat.yunzhen.tech:8083/runde_api/index.php?ctl=group&act=get_group_list", 
      url: URL+"index.php?ctl=group&act=get_group_list", //仅为示例，并非真实接口地址。
      data: {
        admin_id: _this.admin_id
      },
      header: {
        "content-type": "application/json" //自定义请求头信息
      },
      method: "POST",
      success: res => {
        console.log(res)
        if (res.data.msg == "获取成功！") {
          this.text = "request success";
          this.groupNemberList = res.data.data;
        } else {
          
          uni.showToast({
            title: "请重新登录",
            icon: "none",
            duration: 2000
          });
           uni.navigateTo({
      url:
        `/pages/helmet/login?search=true`
    });
        }
       uni.hideLoading()
      },
      fail: res => {
       uni.hideLoading()
        uni.showToast({
          title: "服务器出错，请重试！",
          icon: "none",
          duration: 2000
        });
          uni.navigateTo({
      url:
        `/pages/helmet/login?search=true`
    });
      }
    });
  },
  onBackPress(options) {
			console.log("要指定返回的页面");
		  uni.navigateTo({
                url:
                  `/pages/helmet/login`
              });
			return true;
		},
  methods: {
    btn(item){
      uni.navigateTo({
        url:
          "/pages/helmet/toukui?g_id=" + item.g_id+'&admin_id='+this.admin_id+'&host='+this.host+'&trueone='+false
          
      });
    },
     tabsChange(row){
      console.log(row)
      this.swiperCurrent=row
    }
  }
};
</script>

<style lang="scss" scoped>
.tabs {
  margin-top: -50rpx;
  border-radius: 40rpx 40rpx 0 0;

}
.grid1 {
  // background-image: linear-gradient(to bottom right, red, yellow) !important;
  color: white;
  background-image: linear-gradient(
    to bottom right,
    #ff6895,
    #ffa46d
  ) !important;
  border-radius: 30rpx;
  padding: -10rpx;
  //  background-color: red !important;
  background-clip: content-box !important;
  padding: 10rpx !important;
  //  border:2px solid #92b901 !important;
  //  margin:10rpx;
}
.grid2 {
  // background-image: linear-gradient(to bottom right, red, yellow) !important;
  color: white;
  background-image: linear-gradient(
    to bottom right,
    #41a1f7,
    #68cff0
  ) !important;
  border-radius: 30rpx;
  padding: -10rpx;
  //  background-color: red !important;
  background-clip: content-box !important;
  padding: 10rpx !important;
  //  border:2px solid #92b901 !important;
  //  margin:10rpx;
}
.grid3 {
  // background-image: linear-gradient(to bottom right, red, yellow) !important;
  color: white;
  background-image: linear-gradient(
    to bottom right,
    #a26ffc,
    #d8a6fd
  ) !important;
  border-radius: 30rpx;
  padding: -10rpx;
  //  background-color: red !important;
  background-clip: content-box !important;
  padding: 10rpx !important;
  //  border:2px solid #92b901 !important;
  //  margin:10rpx;
}
.grid5 {
  // background-image: linear-gradient(to bottom right, red, yellow) !important;
  color: white;
  background-image: linear-gradient(
    to bottom right,
    #e770e4,
    #d9aefb
  ) !important;
  border-radius: 30rpx;
  padding: -10rpx;
  //  background-color: red !important;
  background-clip: content-box !important;
  padding: 10rpx !important;
  //  border:2px solid #92b901 !important;
  //  margin:10rpx;
}
.grid4 {
  // background-image: linear-gradient(to bottom right, red, yellow) !important;
  color: white;
  background-image: linear-gradient(
    to bottom right,
   #FDC830,#f37335

  ) !important;
  border-radius: 30rpx;
  padding: -10rpx;
  //  background-color: red !important;
  background-clip: content-box !important;
  padding: 10rpx !important;
  //  border:2px solid #92b901 !important;
  //  margin:10rpx;
}
.contain {
  width: 100%;
  height: 100%;
  position: relative;
  .top-content {
    height: 90upx;
    background: linear-gradient(to left, #1040be, #026dff);
  }
}
.top-content {
  height: 160upx;
  background: linear-gradient(to left, #1040be, #026dff);
}
.top {
  // z-index: 10;
  position: absolute;
  padding: 30rpx 30rpx 18rpx 30rpx;

  width: 100%;
  top: 50rpx;
  background-color: white;
  display: flex;
  border-radius: 40rpx 40rpx 0 0;

  .btn {
    position: absolute;
    right: 35rpx;
    border-radius: 16rpx;
  }
  /deep/ .u-btn--primary {
    background: linear-gradient(to left, #1040be, #026dff);
  }
  /deep/ .uni-input-placeholder {
    font-size: 22rpx;
    color: #989898 !important;
    // line-height:100upx;
  }
  /deep/ .u-mode-plain-primary {
    border: 1px solid #eee;
    box-shadow: 0 0 20rpx #eee;
    border-radius: 16rpx;
    color: #989898;
  }
  /deep/ .u-flex {
    margin-right: 80rpx;
  }
  .image {
    position: absolute;
    width: 28rpx;
    height: 34rpx;
    left: 45rpx;
    // height: 80upx;
  }
  /deep/ .u-size-default {
    padding: 18rpx 24rpx 18rpx 50rpx;
  }
  /deep/ .u-input--border {
    border: 1px solid #eee !important;
    box-shadow: 0 0 20rpx #eee;
    border-radius: 16rpx;
    // color: #989898 !important;
    // height: 60upx;
    // line-height: 20upx;
  }
  /deep/ .u-input__input {
    min-height: 55upx !important;
    color: #989898 !important;
  }
}
.contain {
  // .top {
  //   height: calc(100% - 50upx);
  //  overflow-y: auto;
  // position: absolute;
  // background-color: white;
  // // padding: 30rpx 0rpx;
  // width: 100%;
  // top: 50rpx;
  // border-radius: 40rpx 40rpx 0 0;
  //   /deep/ .is-input-border {
  //     border: 1px solid #eee !important;
  //     box-shadow: 0 0 20rpx #eee;
  //     border-radius: 16rpx;
  //   }
  //   /deep/ .uni-easyinput {
  //     min-height: 55upx !important;
  //     color: #989898 !important;
  //   }
  //   /deep/ .uni-easyinput__content-input {
  //     font-size: 24rpx;
  //     color: #989898 !important;
  //   }
  //   /deep/ .uni-input-placeholder {
  //     font-size: 24rpx;
  //     color: #989898 !important;
  //   }
  // }
  .card {
    width: 100%;
    margin-top: 84rpx;
  }
  .body {
    .text {
      position: relative;
      // margin-top: 10rpx;
      padding-top: 10rpx;
      height: 60rpx;
      line-height: 60rpx;
      text-align: center;
      font-size: 34rpx;
      .right {
        position: absolute;
        top: 6px;
        right: 30rpx;
        color: #777;
      }
    }
    .photo {
      // margin-top: 50rpx;
      padding-top: 60rpx;
      display: flex;
      height: 200rpx;

      .cont {
        flex: 1;
        .center {
          text-align: center;
        }
        .text {
          text-align: center;
          font-size: 28rpx;
          color: #111;
        }
      }
    }
  }
  .box-contet {
    width: 100%;
    overflow-y: auto;
    margin-top: 20rpx;
    .cardlist {
      height: 100%;
      .swiper-item {
        height: 100%;
      }
    }
  }
  .list {
    width: 100%;
    padding: 30rpx;
    .color {
      // border-bottom: 15rpx solid #eee;
    }
  }
  .bottom {
    .title {
      font-size: 18px;
      font-weight: 600;
      text-align: center;
      margin-top: 10px;
    }
    .input {
      width: 100%;
      padding: 20rpx 50rpx 10rpx;
    }
    .foot {
      display: flex;
      .btn {
        flex: 1;
        margin: 60rpx 50rpx 0rpx;
      }
    }
  }
  // .fixs {
  //   position: fixed;
  //   bottom: 100rpx;
  //   right: 40rpx;
  //   width: 120rpx;
  //   height: 120rpx;
  //   background: #333;
  //   background: linear-gradient(-34deg, #1040be, #026dff);
  //   // opacity: 0.3;
  //   border-radius: 50%;
  //    display: flex;
  //    justify-content: center;
  //    align-items: center;
  // }
  .fix {
    position: fixed;
    bottom: 100rpx;
    right: 40rpx;
    z-index: 9999;
    image {
      height: 120rpx;
      width: 120rpx;
    }
  }
}
/deep/ .u-swipe-action {
  // position: relative;
}
/deep/ .u-swipe-content {
  // width:1200rpx
}
/deep/ .u-swipe-del {
  // overflow: hidden;
  // right: -20rpx;
  // position: relative;
  // width:50rpx !important;
  left: 4rpx;
  // height: 280rpx;
  margin-bottom: 20rpx;
  // top: 80rpx;
  // margin-right: 10rpx;
  border-radius: 25rpx;
}
/deep/ .u-swipe-view {
  width: 100%;
  // background-color: red;
}

/deep/ .u-mode-center-box {
  height: initial !important;
}
/deep/ .uni-scroll-view {
  height: initial !important;
  margin: 10px 4px;
}
/deep/ .content-clear-icon {
  font-size: 32rpx;
}
/deep/ .uni-easyinput__content {
  background-color: white;
}
.bottombox {
  margin-top: 15rpx;
  width: 100%;
  height: 50rpx;
  position: absolute;
  background-color: rgba(16, 91, 245, 74%);
  border-radius: 20px;
  color: white;
  width: 170rpx;
  display: flex;
  align-items: center; /*垂直居中 */
  justify-content: center;
  right: 64%;
  bottom: 8.5%;
}

.bottombox1 {
  margin-top: 15rpx;
  width: 100%;
  height: 50rpx;
  position: absolute;
  background-color: rgba(16, 91, 245, 74%);
  border-radius: 20px;
  color: white;
  width: 170rpx;
  display: flex;
  align-items: center; /*垂直居中 */
  justify-content: center;
  right: 34%;
  bottom: 8.5%;
}

.bottombox2 {
  margin-top: 15rpx;
  width: 100%;
  height: 50rpx;
  position: absolute;
  background-color: rgba(16, 91, 245, 74%);
  border-radius: 20px;
  color: white;
  width: 170rpx;
  display: flex;
  align-items: center; /*垂直居中 */
  justify-content: center;
  right: 37%;
  bottom: 14%;
}
.select {
  width: 100%;
  height: 80rpx;
  margin-top: 20rpx;
  border-radius: 20rpx;
}
</style>

